from django.urls import path, re_path
from course.views import CourseDirectionListApiView, CourseCategoryListApiView, CourseListApiView, CourseDetaileView, CourseChapterListApiView, CourseSearchViewSet
from rest_framework import routers
router = routers.SimpleRouter()
# 注册全文搜索到视图集中生成url路由信息
router.register("search", CourseSearchViewSet, basename="course-search")
urlpatterns = [
  # 课程方向
  path('direction/', CourseDirectionListApiView.as_view()),
  # 课程分类
  re_path(r'^category/(?P<directionID>\d+)/$', CourseCategoryListApiView.as_view()),
  # 课程列表
  re_path(r'^course/(?P<directionID>\d+)/(?P<categoryID>\d+)/$', CourseListApiView.as_view()),
  # 课程详情
  re_path(r'^detailes/(?P<courseID>\d+)/$', CourseDetaileView.as_view()),
  # 课程章节、课时
  re_path(r'^(?P<courseID>\d+)/chapters/$', CourseChapterListApiView.as_view()),
] + router.urls
